package Song.Han.Demo01;

public class Demo04 {
    public static void main(String[] args) {
        A a = new A();
        System.out.println(A.m);
    }
}

/*
    1.加载到内存，产生一个类对应的Class对象
    2.链接，结束后m = 0
    3.初始化：（合并并执行static代码块）
        <clinit>(){
            System.out.println("A类静态代码块初始化");
            m = 100;
            m = 300;
        }

        得到m为300


*/

class A{
    static {
        System.out.println("A类静态代码块初始化");
        m = 100;
    }
    static int m = 300;


    public A() {
        System.out.println("A类的无参构造初始化");
    }
}